package cn.edu.zafu.bigdata.lyq;

final class FinalClass {
    public void method() {
        System.out.println("This is a final class method.");
    }
}
// 尝试继承 final 类会报错
// class SubClassOfFinal extends FinalClass {}

class WithFinalMethod {
    public final void finalMethod() {
        System.out.println("This is a final method.");
    }
}
// 尝试重写 final 方法会报错
// class SubClass extends WithFinalMethod {
//     @Override
//     public void finalMethod() {}
// }
class FinalVariableExample {
    public static void main(String[] args) {
        final int num = 10;
        // num = 20; // 报错
        System.out.println(num);
    }
}